﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InterfaceFiles
{
  public class PDXSWMM4InterfaceFile : IInterfaceFile
  {
    private IInterfaceReader reader;
    private IInterfaceWriter writer;

    private PDXSWMM4InterfaceHeader header;
    private PDXSWMM4InterfaceRecord currentRecord;

    public PDXSWMM4InterfaceFile(string fileName)
    {
      reader = new PDXSWMM4InterfaceReader(fileName);
      writer = null; // to be replaced by an appropriate writer

      header = new PDXSWMM4InterfaceHeader(reader);
      header.Read();
      currentRecord = new PDXSWMM4InterfaceRecord(reader, header.Nodes);
    }

    public void WriteRecord(IInterfaceRecord record)
    {
      throw new NotImplementedException();
    }

    public void WriteHeader(IInterfaceHeader header)
    {
      throw new NotImplementedException();
    }

    public void WriteInterface(IInterfaceFile interfaceFile)
    {
      throw new NotImplementedException();
    }

    public IInterfaceRecord ReadRecord()
    {
      currentRecord.Read();
      return currentRecord;
    }

    public IInterfaceHeader ReadHeader()
    {
      return header;
    }

    public bool IsEndOfFile
    {
      get { return reader.IsEndOfFile; }
    }
  }
}
